MacHTTP can understand a limited set of AppleEvents. See the ReadMe.html file for specific details. In addition, the "More Scripts" folder contains some examples of how to script MacHTTP.
Sending AppleEvents from MacHTTP
--------------------------------
In addition to executing AppleScripts by compiling AppleScript source code on the fly, MacHTTP can execute stand-alone applications or AppleScript applications that understand a specific AppleEvent, passing search arguments to them.
MacHTTP defines a custom AppleEvent that it sends to applications that are capable of performing search actions, etc. If you define a suffix mapping of type "APPL", MacHTTP will attempt to execute the application pointed to by the requested URL and will pass the application any search arguments received from the WWW client via this AppleEvent. The specifics are as follows:
The Event Suite is 'WWWΩ'
The event code is 'srch'
The direct parameter contains the search arguments as passed from the WWW client to MacHTTP.
MacHTTP expects the AppleEvent reply's direct parameter to contain HTML text that will be transmitted to the client.
If you are a C or Pascal programmer, the above information will make sense. If you are creating compiled AppleScript applications, see the "search.exe" file in this folder for an example of how to handle receiving events from MacHTTP. AppleScripts that contain a handler that starts with the line:
on «event WWWΩsrch» search_args
will be launched automatically, and the handler will be invoked with search_args appropriately defined.
IMPORTANT NOTE!!!!
"search.exe" must be loaded into the Script Editor and Saved As an Application with the Keep Open and Never Show Startup Screen boxes checked before using it with MacHTTP!!!